execute unless items entity @s weapon.mainhand *[custom_data~{type:"bow"}] run return fail

summon armor_stand ~ ~ ~ {Tags:["tempEntity"]}
item replace entity @n[tag=tempEntity,type=armor_stand] weapon.mainhand from entity @s weapon.mainhand
item replace entity @s weapon.mainhand with air

execute store result score #can_use_count temp run data get entity @n[tag=tempEntity,type=armor_stand] HandItems[0].components."minecraft:custom_data".can_use_count
$execute store result entity @n[tag=tempEntity,type=armor_stand] HandItems[0].components."minecraft:custom_data".can_use_count int 1 run scoreboard players remove #can_use_count temp $(value)
item replace entity @s weapon.mainhand from entity @n[tag=tempEntity,type=armor_stand] weapon.mainhand

#bow break
execute if items entity @s weapon.mainhand *[custom_data~{type:"bow",can_use_count:0}] run function dab:system/generic_bow/durability/bow_break with entity @s SelectedItem.components."minecraft:custom_data".run

execute if items entity @s weapon.mainhand *[custom_data~{type:"bow"}] run item modify entity @s weapon.mainhand dab:display_can_use/update

kill @n[tag=tempEntity,type=armor_stand]
scoreboard players reset #can_use_count temp